import React from "react";
import PubSub from "pubsub-js";
export default function B() {
  return (
    <div>
      <input type="text" />
      <button onClick={(e) => {
        //发布消息
        PubSub.publish('content', e.target.previousSibling.value)
      }}>显示</button>
      <hr />
    </div>
  );
}
